﻿using HelfenHelfen.Web.MVC.Controllers;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting.Web;
using HelfenHelfen.Web.MVC.Models.Views;
using System.Web;
using System.Web.Mvc;
using HelfenHelfen.Logic.Factories;
using HelfenHelfen.Web.MVC.Tests.Fakes;
using HelfenHelfen.DataAccess.Entities;
using HelfenHelfen.Web.MVC.Tests.Controllers;

namespace HelfenHelfen.Web.MVC.Tests
{


    /// <summary>
    ///This is a test class for BonusItemControllerTest and is intended
    ///to contain all BonusItemControllerTest Unit Tests
    ///</summary>
    [TestClass()]
    public class BonusItemControllerTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion



        public void BonusItemControllerConstructorTest()
        {

            BonusItemController target = new BonusItemController();
            Assert.Inconclusive("TODO: Implement code to verify target");
        }

        [TestMethod()]
        public void CreateTest()
        {
            
            LogicFactory.BonusItemLogicType = typeof(BonusItemLogicFake);

            BonusItemController target = new BonusItemController();

            BonusItem newBonusItem = new BonusItem() {  ShortTesx = " xccc" , Description = "Ipsum" };
            BonusItemView newBonusItemView = new BonusItemView();
            newBonusItemView.BonusItem = newBonusItem;

            ActionResult actual = target.CreateModel(newBonusItemView);

            Assert.IsNotNull(actual as RedirectToRouteResult);


            Assert.AreEqual(true, ((RedirectToRouteResult)actual).RouteValues.ContainsValue("Index"));

        }

        [TestMethod()]
        public void CreateTestEmptyShortTex()
        {

            LogicFactory.BonusItemLogicType = typeof(BonusItemLogicFake);

            BonusItemController target = new BonusItemController();

            BonusItem newBonusItem = new BonusItem() { ShortTesx = "", Description = "Ipsum" };
            BonusItemView newBonusItemView = new BonusItemView();
            newBonusItemView.BonusItem = newBonusItem;

            var actual = target.CreateModel(newBonusItemView) as ViewResult;

            Assert.IsNotNull(actual);


            Assert.AreEqual("Ipsum", ((BonusItemView)actual.ViewData.Model).BonusItem.Description);

        }

        ///// <summary>
        /////A test for Create
        /////</summary>
        //// TODO: Ensure that the UrlToTest attribute specifies a URL to an ASP.NET page (for example,
        //// http://.../Default.aspx). This is necessary for the unit test to be executed on the web server,
        //// whether you are testing a page, web service, or a WCF service.
        //[TestMethod()]
        //[HostType("ASP.NET")]
        //[AspNetDevelopmentServerHost("C:\\Source\\helfenhelfen\\HelfenHelfen\\Source\\MVC\\HelfenHelfen.Web.MVC", "/")]
        //[UrlToTest("http://localhost:55325/")]
        //public void CreateTest1()
        //{
        //    BonusItemController target = new BonusItemController(); // TODO: Initialize to an appropriate value
        //    ActionResult expected = null; // TODO: Initialize to an appropriate value
        //    ActionResult actual;
        //    actual = target.Create();
        //    Assert.AreEqual(expected, actual);
        //    Assert.Inconclusive("Verify the correctness of this test method.");
        //}

        ///// <summary>
        /////A test for Delete
        /////</summary>
        //// TODO: Ensure that the UrlToTest attribute specifies a URL to an ASP.NET page (for example,
        //// http://.../Default.aspx). This is necessary for the unit test to be executed on the web server,
        //// whether you are testing a page, web service, or a WCF service.
        //[TestMethod()]
        //[HostType("ASP.NET")]
        //[AspNetDevelopmentServerHost("C:\\Source\\helfenhelfen\\HelfenHelfen\\Source\\MVC\\HelfenHelfen.Web.MVC", "/")]
        //[UrlToTest("http://localhost:55325/")]
        //public void DeleteTest()
        //{
        //    BonusItemController target = new BonusItemController(); // TODO: Initialize to an appropriate value
        //    Guid id = new Guid(); // TODO: Initialize to an appropriate value
        //    ActionResult expected = null; // TODO: Initialize to an appropriate value
        //    ActionResult actual;
        //    actual = target.Delete(id);
        //    Assert.AreEqual(expected, actual);
        //    Assert.Inconclusive("Verify the correctness of this test method.");
        //}

        ///// <summary>
        /////A test for Delete
        /////</summary>
        //// TODO: Ensure that the UrlToTest attribute specifies a URL to an ASP.NET page (for example,
        //// http://.../Default.aspx). This is necessary for the unit test to be executed on the web server,
        //// whether you are testing a page, web service, or a WCF service.
        //[TestMethod()]
        //[HostType("ASP.NET")]
        //[AspNetDevelopmentServerHost("C:\\Source\\helfenhelfen\\HelfenHelfen\\Source\\MVC\\HelfenHelfen.Web.MVC", "/")]
        //[UrlToTest("http://localhost:55325/")]
        //public void DeleteTest1()
        //{
        //    BonusItemController target = new BonusItemController(); // TODO: Initialize to an appropriate value
        //    Guid id = new Guid(); // TODO: Initialize to an appropriate value
        //    string confirmButton = string.Empty; // TODO: Initialize to an appropriate value
        //    ActionResult expected = null; // TODO: Initialize to an appropriate value
        //    ActionResult actual;
        //    actual = target.Delete(id, confirmButton);
        //    Assert.AreEqual(expected, actual);
        //    Assert.Inconclusive("Verify the correctness of this test method.");
        //}

        ///// <summary>
        /////A test for Details
        /////</summary>
        //// TODO: Ensure that the UrlToTest attribute specifies a URL to an ASP.NET page (for example,
        //// http://.../Default.aspx). This is necessary for the unit test to be executed on the web server,
        //// whether you are testing a page, web service, or a WCF service.
        //[TestMethod()]
        //[HostType("ASP.NET")]
        //[AspNetDevelopmentServerHost("C:\\Source\\helfenhelfen\\HelfenHelfen\\Source\\MVC\\HelfenHelfen.Web.MVC", "/")]
        //[UrlToTest("http://localhost:55325/")]
        //public void DetailsTest()
        //{
        //    BonusItemController target = new BonusItemController(); // TODO: Initialize to an appropriate value
        //    int id = 0; // TODO: Initialize to an appropriate value
        //    ActionResult expected = null; // TODO: Initialize to an appropriate value
        //    ActionResult actual;
        //    actual = target.Details(id);
        //    Assert.AreEqual(expected, actual);
        //    Assert.Inconclusive("Verify the correctness of this test method.");
        //}

        ///// <summary>
        /////A test for Edit
        /////</summary>
        //// TODO: Ensure that the UrlToTest attribute specifies a URL to an ASP.NET page (for example,
        //// http://.../Default.aspx). This is necessary for the unit test to be executed on the web server,
        //// whether you are testing a page, web service, or a WCF service.
        //[TestMethod()]
        //[HostType("ASP.NET")]
        //[AspNetDevelopmentServerHost("C:\\Source\\helfenhelfen\\HelfenHelfen\\Source\\MVC\\HelfenHelfen.Web.MVC", "/")]
        //[UrlToTest("http://localhost:55325/")]
        //public void EditTest()
        //{
        //    BonusItemController target = new BonusItemController(); // TODO: Initialize to an appropriate value
        //    Guid id = new Guid(); // TODO: Initialize to an appropriate value
        //    ActionResult expected = null; // TODO: Initialize to an appropriate value
        //    ActionResult actual;
        //    actual = target.Edit(id);
        //    Assert.AreEqual(expected, actual);
        //    Assert.Inconclusive("Verify the correctness of this test method.");
        //}

        ///// <summary>
        /////A test for Edit
        /////</summary>
        //// TODO: Ensure that the UrlToTest attribute specifies a URL to an ASP.NET page (for example,
        //// http://.../Default.aspx). This is necessary for the unit test to be executed on the web server,
        //// whether you are testing a page, web service, or a WCF service.
        //[TestMethod()]
        //[HostType("ASP.NET")]
        //[AspNetDevelopmentServerHost("C:\\Source\\helfenhelfen\\HelfenHelfen\\Source\\MVC\\HelfenHelfen.Web.MVC", "/")]
        //[UrlToTest("http://localhost:55325/")]
        //public void EditTest1()
        //{
        //    BonusItemController target = new BonusItemController(); // TODO: Initialize to an appropriate value
        //    BonusItemView bonusItemView = null; // TODO: Initialize to an appropriate value
        //    HttpPostedFileBase pictureFile = null; // TODO: Initialize to an appropriate value
        //    ActionResult expected = null; // TODO: Initialize to an appropriate value
        //    ActionResult actual;
        //    actual = target.Edit(bonusItemView, pictureFile);
        //    Assert.AreEqual(expected, actual);
        //    Assert.Inconclusive("Verify the correctness of this test method.");
        //}

        ///// <summary>
        /////A test for Index
        /////</summary>
        //// TODO: Ensure that the UrlToTest attribute specifies a URL to an ASP.NET page (for example,
        //// http://.../Default.aspx). This is necessary for the unit test to be executed on the web server,
        //// whether you are testing a page, web service, or a WCF service.
        //[TestMethod()]
        //[HostType("ASP.NET")]
        //[AspNetDevelopmentServerHost("C:\\Source\\helfenhelfen\\HelfenHelfen\\Source\\MVC\\HelfenHelfen.Web.MVC", "/")]
        //[UrlToTest("http://localhost:55325/")]
        //public void IndexTest()
        //{
        //    BonusItemController target = new BonusItemController(); // TODO: Initialize to an appropriate value
        //    Nullable<int> page = new Nullable<int>(); // TODO: Initialize to an appropriate value
        //    ActionResult expected = null; // TODO: Initialize to an appropriate value
        //    ActionResult actual;
        //    actual = target.Index(page);
        //    Assert.AreEqual(expected, actual);
        //    Assert.Inconclusive("Verify the correctness of this test method.");
        //}

        ///// <summary>
        /////A test for ShowBonusItemPicture
        /////</summary>
        //// TODO: Ensure that the UrlToTest attribute specifies a URL to an ASP.NET page (for example,
        //// http://.../Default.aspx). This is necessary for the unit test to be executed on the web server,
        //// whether you are testing a page, web service, or a WCF service.
        //[TestMethod()]
        //[HostType("ASP.NET")]
        //[AspNetDevelopmentServerHost("C:\\Source\\helfenhelfen\\HelfenHelfen\\Source\\MVC\\HelfenHelfen.Web.MVC", "/")]
        //[UrlToTest("http://localhost:55325/")]
        //public void ShowBonusItemPictureTest()
        //{
        //    BonusItemController target = new BonusItemController(); // TODO: Initialize to an appropriate value
        //    Guid bonusItemId = new Guid(); // TODO: Initialize to an appropriate value
        //    ActionResult expected = null; // TODO: Initialize to an appropriate value
        //    ActionResult actual;
        //    actual = target.ShowBonusItemPicture(bonusItemId);
        //    Assert.AreEqual(expected, actual);
        //    Assert.Inconclusive("Verify the correctness of this test method.");
        //}
    }
}
